// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'

// ============================== 导出异步调用 ============================== //

export default {
  // —————————————————————————————— 单项 —————————————————————————————— //

  async remoteOne({ state: { API, MAP, one } }) {
    const param = {
      spareId: [one.spareDto.id],
      warehouseId: [one.warehouseDto.id],
      pageSize: CORE.MAP.PAGE_SIZE_SELECT,
    }
    const TIP = API.transTip(MAP.tipOne)
    const obj = await API.getOne(param, TIP)
    return transOne(obj, one)
  },
}

// ============================== 转换方法 ============================== //

const transOne = (obj, one) => {
  return { ...one, ...obj }
}
